package com.pp.service.impl;

import com.pp.common.pojo.Comment;
import com.pp.common.pojo.User;
import com.pp.common.vo.CommentVo;
import com.pp.mapper.CommentMapper;
import com.pp.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class CommentServiceImpl implements CommentService {
    @Autowired
    private CommentMapper commentMapper;

    @Override
    public List<CommentVo> selectComment(Integer id) {
        List<CommentVo> list = commentMapper.selectComment(id);
        return list;
    }

    @Override
    @Transactional
    public void userByname(Comment comment) {
        comment.setCommentStatus(1);
        comment.setCommentLikeNum(0);
        comment.setCommentReportNum(0);
        commentMapper.insert(comment);
    }
}
